<%@ Control Language="C#" AutoEventWireup="true" Inherits="CMS.Web.UI.UserControls.MessageBox" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>

<asp:Repeater ID="repeaterMessage" runat="server">
    <HeaderTemplate>
        <table>
    </HeaderTemplate>
    <ItemTemplate>
        <tr>
            <td><a href="?Page=<%= Page.PageID %>&Message=<%# Eval("MessageID") %>"><img src="/Pics/CMS/Mail<%# ((bool)Eval("IsRead")?"Open":"") %>.png" alt="View" /></a></td>
            <td><%# Eval("Message.MessageTitle") %></td>
            <td><%# Eval("Message.Sender.UserName") %></td>
            <td><%# Eval("Message.MessageDate") %></td>
            <td><a href="?Page=<%= Page.PageID %>&Delete=<%# Eval("MessageID") %>"><img src="/Pics/CMS/Delete.png" alt="X" /></a></td>
        </tr>
    </ItemTemplate>
    <FooterTemplate>
        </table>
    </FooterTemplate>
</asp:Repeater>

<asp:UpdatePanel ID="upMessageSend" runat="server" ChildrenAsTriggers="true">
    <ContentTemplate>
        <table>
            <tr>
                <td><asp:Label runat="server" ID="lReceiver" Text="Receiver(s)" /></td>
                <td colspan="2"><asp:TextBox ID="tbReceiver" runat="server" /></td>
            </tr>
            <tr>
                <td><asp:Label runat="server" ID="lGroup" Text="Groups" /></td>
                <td><asp:DropDownList ID="ddlGroup" runat="server" /></td>
                <td><asp:Button ID="bAddGroupToReceiver" runat="server" Text="Add" /></td>
            </tr>
            <tr>
                <td><asp:Label runat="server" ID="lMessageCreateTitle" Text="Title" /></td>
                <td colspan="2"><asp:TextBox ID="tbMessageTitle" runat="server" /></td>
            </tr>
            <tr>
                <td colspan="3"><FCKeditorV2:FCKeditor ID="wysiwygEditor" runat="server" ToolbarSet="BizMessage" Width="500" Height="400" /></td>
            </tr>
            <tr>
                <td colspan="3"><asp:Button ID="bSendMessage" runat="server" Text="Send Message" /></td>
            </tr>
        </table>
    </ContentTemplate>
</asp:UpdatePanel>

<asp:PlaceHolder ID="phMessageView" runat="server">
    <table>
        <tr>
            <td><asp:Label runat="server" ID="lMessageViewTitle" Text="Title" /></td>
            <td><asp:Label ID="lMessageTitle" runat="server" /></td>
        </tr>
        <tr>
            <td><asp:Label runat="server" ID="lMessageViewDate" Text="Date" /></td>
            <td><asp:Label ID="lMessageDate" runat="server" /></td>
        </tr>
        <tr>
            <td><asp:Label runat="server" ID="lMessageViewSender" Text="Sender" /></td>
            <td><asp:Label ID="lSender" runat="server" /></td>
        </tr>
        <tr>
            <td colspan="2"><asp:Literal ID="lMessageBody" runat="server" /></td>
        </tr>
    </table>
</asp:PlaceHolder>
            
<asp:UpdatePanel ID="upGroupEditor" runat="server">
    <ContentTemplate>
        <asp:Repeater runat="server" ID="repeaterGroup">
            <HeaderTemplate>
                <table>
            </HeaderTemplate>
            <ItemTemplate>
                <tr>
                    <td><a href="?Page=<%= Page.PageID %>&MessageGroup=<%# Eval("MessageGroupID") %>"><%# Eval("GroupName")%></a></td>
                    <td><a href="?Page=<%= Page.PageID %>&DeleteGroup=<%# Eval("MessageGroupID") %>"><img src="/Pics/CMS/Delete.png" alt="X" /></a></td>
                </tr>
            </ItemTemplate>
            <FooterTemplate>
                </table>
            </FooterTemplate>
        </asp:Repeater>
        <asp:TextBox ID="tbGroupName" runat="server" />
        <asp:Button ID="bAddGroup" runat="server" Text="Validate Group" />
        <asp:UpdatePanel runat="server" ID="upGroupUserEditor">
            <ContentTemplate>
                <table>
                    <tr>
                        <td><asp:Label runat="server" ID="lGroupUserName" Text="UserName" /></td>
                        <td><asp:TextBox ID="tbGroupUserName" runat="server" /></td>
                        <td><asp:Button ID="bAddGroupUser" runat="server" Text="Add to Group" /></td>
                    </tr>
                    <tr>
                        <td colspan="3"><asp:ListBox runat="server" ID="lbGroupUser" /></td>
                    </tr>
                    <tr>
                        <td colspan="3"><asp:Button ID="bRemoveGroupUser" runat="server" Text="Remove from Group" /></td>
                    </tr>
                </table>
            </ContentTemplate>
        </asp:UpdatePanel>
    </ContentTemplate>
</asp:UpdatePanel>
